package com.sixth.controller;

import com.sixth.entity.Backlightcolor;
import com.sixth.service.BackLightColorService;
import com.sixth.util.CommonResult;
import com.sixth.util.TableLayUi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: project01
 * @description:
 * @author: 老魏
 * @create: 2021-12-23 19:33
 **/
@RestController
@RequestMapping("/backlightcolor")
public class BackLightColorController {
    @Autowired
    private BackLightColorService backLightColorService;

    @RequestMapping("/AllBackLightColor")
    public CommonResult getAllBackLightColor(){
        CommonResult commonResult=backLightColorService.findAllBackLightColor();
        return  commonResult;
    }
    @RequestMapping("/deleteBackLightColor")
    public CommonResult deleteBackLightColor(Integer backlightcolorid) {
        return backLightColorService.deleteBackLightColor(backlightcolorid);
    }

    @RequestMapping("/addOrUpdateBackLightColor")
    public CommonResult addOrUpdateBackLightColor(Backlightcolor backlightcolor) {
        if (backlightcolor.getBacklightcolorid()!=null){
            return backLightColorService.updateBackLightColor(backlightcolor);
        }else {
            return  backLightColorService.addBackLightColor(backlightcolor);
        }
    }
    //开启分页
    @RequestMapping("/listByCondition")
    public TableLayUi listByCondition(int page, int limit ){
        return  backLightColorService.findlightCondition(page,limit);
    }
}
